package javaapplication1;

import java.awt.Graphics;
import java.util.ArrayList;

public class Scene implements Drawable{
    private int ancho;
    private Integer alto;
    private Level level;
    private ArrayList<Drawable> drawableList;
    
    public Scene(int ancho, int alto){
        this.ancho = ancho;
        this.alto = alto;
        drawableList = new ArrayList<Drawable>();
    }

    @Override
    public void dibujar(Graphics g) {
        for (Drawable d : drawableList) d.dibujar(g);
        for(Brick b : level.getBloqueList()) {
            b.dibujar(g);
        }
    }
    
    public void aniadir(Drawable drawable){
        drawableList.add(drawable);
    }
    
    public void eliminar(Drawable drawable){
        drawableList.remove(drawable);
    }
    
    public Drawable obtenerHijo(int pos){
        return drawableList.get(pos);
    }

    public Integer getAlto() {
        return alto;
    }

    public int getAncho() {
        return ancho;
    }

    public void setLevel(Level level) {
        this.level = level;
    }

    public Level getLevel() {
        return level;
    }

    @Override
    public void accept(Visitor visitor) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    
    
}
